package com.bandi.tharshesnows.model;


public class Picture extends PersistentModel{

  private String imageURL;
  private String thumbURL;
  private String imageName;
  private String thumbName;

  public String getImageURL() {
    return imageURL;
  }

  public void setImageURL(String imageURL) {
    this.imageURL = imageURL;
    imageName = getNameFromURL(imageURL);
  }

  public String getThumbURL() {
    return thumbURL;
  }

  public void setThumbURL(String thumbURL) {
    this.thumbURL = thumbURL;
    thumbName = getNameFromURL(thumbURL);
  }

  public String getImageName() {
    return imageName;
  }

  public String getThumbName() {
    return thumbName;
  }

  private String getNameFromURL(String url) {
    int lastSeparatorLocation = url.lastIndexOf("/");
    return url.substring(lastSeparatorLocation + 1, url.length());
  }

}
